/**
 * Created by wyy on 17-6-21.
 */
angular.module('approveList', []).component(
    'approveList',
    {
        templateUrl: 'component/approve/approveList/approve_list.template.html',
        controller: ['$rootScope','$scope', '$state', 'Alert', function ($rootScope,$scope, $state,Alert) {



                $scope.approveHeaders = ['', '企业名称', '法人姓名', '联系人姓名', '手机号'];
                $scope.prevPageClick=prevPageClick;
                $scope.nextPageClick=nextPageClick;
                $scope.showCompanyDetail = showCompanyDetail;


                //展示当前公司的详细信息
                function showCompanyDetail(company)
                {
                    $state.go('company.approveInfo', {companyId: company.id});
                }

                function prevPageClick() {
                    if ($scope.$parent.prevSkip != null)
                    {
                        $scope.$parent.getCompaniesList(3,$scope.$parent.prevSkip,'asc');
                    }
                }
                function  nextPageClick() {
                    if ($scope.$parent.nextSkip != null && $scope.$parent.hasMore == true)
                    {
                        // $scope.$parent.pageNum ++;
                        $scope.$parent.getCompaniesList(null,$scope.$parent.nextSkip,'desc');
                    }
                    else
                    {
                        Alert.alertBox("已经是最后一页",null);
                    }

                }


            }


        ]
    }
);